package com.itheima.a14waitandnotify;

import java.util.concurrent.ArrayBlockingQueue;

public class Foodie extends Thread{
    ArrayBlockingQueue<String> queue;

    public Foodie(ArrayBlockingQueue<String> queue){
        this.queue = queue;
    }
    @Override
    public void run() {
        while(true){
            //把面条放到阻塞队列中
            try {
                String food = queue.take();
                System.out.println("小胖吃了一碗"+food);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
